import 'package:flutter/material.dart';

class Home extends StatefulWidget {
  @override
  HomeState createState() => new HomeState();
}
//头部： 搜索栏 百度语言 个人设置
class HomeState extends State<Home> {

  Widget buildSearch(){
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(24.0)),
        color: Colors.white
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            margin: EdgeInsets.symmetric(horizontal: 12.0),
            child: Icon(Icons.search,color: Colors.grey,),
          ),
          Flexible(child: TextField(
            decoration: InputDecoration.collapsed(hintText: '搜目的地、找停车场'),
          )),
          Container(
            child: IconButton(icon: Icon(Icons.mic_none), onPressed: null),
          )
        ],
      )
    );
  }

  Widget buildWeather(){
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 5.0,vertical: 10.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            margin: EdgeInsets.symmetric(vertical: 10.0),
            decoration: BoxDecoration(
              border: Border.all(color: Colors.white),
              color: Colors.black54,
              borderRadius: BorderRadius.all(Radius.circular(8.0))
            ),
            child: Text('泰州',style: TextStyle(color: Colors.white),),
          ),
          Container(
            height: 100.0,
            decoration: BoxDecoration(
              border: Border.all(color: Colors.black,)
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                Row(
                  children: <Widget>[
                    Flexible(child: Row(
                      children: <Widget>[
                        Icon(Icons.center_focus_weak),
                        Text('多云')
                      ],
                    )),
                    Flexible(child: Row(
                      children: <Widget>[
                        Icon(Icons.center_focus_weak),
                        Text('多云')
                      ],
                    ))
                  ],
                ),
                Row(
                  children: <Widget>[
                    Flexible(child: Row(
                      children: <Widget>[
                        Icon(Icons.center_focus_weak),
                        Text('多云')
                      ],
                    )),
                    Flexible(child: Row(
                      children: <Widget>[
                        Icon(Icons.center_focus_weak),
                        Text('多云')
                      ],
                    ))
                  ],
                ),
              ],
            ),
          )
        ],
      ),
    );
  }

  Widget buildBody(){
    return Container(
      margin: EdgeInsets.symmetric(vertical: 5.0,horizontal: 10.0),
      child: Column(
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: <Widget>[
              Container(
                height: 250.0,
                width: 250.0,
                decoration: BoxDecoration(
                  color: Colors.yellow
                ),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Icon(Icons.cancel),
                    Text('扫码支付')
                  ],
                ),
              ),
              Flexible(child:Container(
                height: 250.0,
                width: 250.0,
                decoration: BoxDecoration(
                  color: Colors.blue
                ),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Icon(Icons.cancel),
                    Text('场内找车')
                  ],
                ),
              ) ,),
            ],
          ),
          Container(
            height: 200.0,
            decoration: BoxDecoration(
              color: Colors.green
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Icon(Icons.search),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text('找车位'),
                    Text('目的地'),
                    Text('导航'),
                  ],
                )
              ],
            ),
          )
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: buildSearch(),
      ),
      body: Column(
        children: <Widget>[
          buildWeather(),
          buildBody()
        ],
      ),
    );
  }
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }

  @override
  void didUpdateWidget(Home oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
  }
}